import request from "@/util/request";
import { FilmResponseData } from "@/api/moive/type.ts";

// 移动端API接口
const MobileAPI = {
  ALL_URL: "/movie/page",
  BANNER_URL: "/movie/banner",
  FILM_DETAIL: "/movie/movie",
  FILM_SHOW: "/show/movies",
  FilmOrder: "/order/buy",
  UserOrder: "/order/page",
  SeatByMoiveId: "/order/movies",
  FILM_BY_TYPE: "/movie/pageByType",
  MOIVE_REVIEW: "/review/movie",
  ADD_REVIEW: "/review/add",
  LIKE_REVIEW: "/review/like"
};

// 移动端API请求函数
export const mobileReqAllFilm = (data: any) =>
  request.post<string, FilmResponseData>(MobileAPI.ALL_URL, data);

export const mobileReqBanner = () =>
  request.get<string, any>(MobileAPI.BANNER_URL);

export const mobileReqFilmDetail = (id: number) =>
  request.post<string, any>(`${MobileAPI.FILM_DETAIL}/${id}`);

export const mobileReqFilmShow = (id: number) =>
  request.get<string, any>(`${MobileAPI.FILM_SHOW}/${id}`);

export const mobileReqFilmOrder = (data: any) =>
  request.post<string, any>(`${MobileAPI.FilmOrder}`, data);

export const mobileGetUserOrder = (data: any) => {
  return request.post<string, any>(`${MobileAPI.UserOrder}`, data);
};

export const mobileReturnSeatByMovieId = (id: any) => {
  return request.get<string, any>(`${MobileAPI.SeatByMoiveId}/${id}`);
};

export const mobileReqFilmByType = (data: any) =>
  request.post<string, FilmResponseData>(MobileAPI.FILM_BY_TYPE, data);

export const mobileGetAllReviews = (movieId: number) =>
  request.get<string, any>(`${MobileAPI.MOIVE_REVIEW}/${movieId}`);

export const mobileAddReview = (data: any) =>
  request.post<string, any>(MobileAPI.ADD_REVIEW, data);

export const mobileLikeReview = (id: number) =>
  request.put<string, any>(`${MobileAPI.LIKE_REVIEW}/${id}`);